package v1

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"go-mall/service"
	"net/http"
)

func UploadImg(c *gin.Context) {
	uploadService := service.UploadService{}
	file, _ := c.FormFile("file")
	if err := c.ShouldBind(&uploadService); err == nil {
		res := uploadService.UploadImg(file)
		c.JSON(http.StatusOK, res)
	} else {
		fmt.Println("Error", err)
		c.JSON(http.StatusBadRequest, err.Error())
	}
}
